<!doctype html>
<html lang="zh-cn">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>overflow实现边框线条动画</title>
  <!--  <link rel="stylesheet" href="./styles/index.css">-->
</head>
<style>
  body, html {
    width: 100%;
    height: 100%;
    display: flex;
    background: yellowgreen;
  }

  div {
    position: relative;
    margin: auto;
    width: 200px;
    height: 100px;
    line-height: 100px;
    text-align: center;
    overflow: hidden;
  }
  div::after {
    content: "Hover Me";
    position: absolute;
    top: 4px;
    bottom: 4px;
    right: 4px;
    left: 4px;
    line-height: 92px;
    font-size: 24px;
    background: #fff;
    border: 2px solid yellowgreen;
    cursor: pointer;
    color: yellowgreen;
  }
  div::before {
    content: "";
    position: absolute;
    top: 0px;
    bottom: 0px;
    right: 0px;
    left: 0px;
    background: #fff;
    transform: rotateZ(-90deg) translate(-100%, -100%);
    transform-origin: top left;
    transition: transform 0.3s;
    transition-timing-function: linear;
  }
  div:hover::before {
    transform: rotateZ(0) translate(0, 0);
  }

  div:nth-child(1):hover {
    transform: rotateZ(0deg) translate(0%, 0%);
  }

</style>
<body>
<div>Hover Me</div>
</body>
</html>
